﻿// JScript File
	var bz_http_request_post = false;
	var bz_http_request_post_val=0;
	function bzDoSendAjax(url, parameters,val)
	{	 		  
	    bz_http_request_post = false;
		bz_http_request_post_val=val;    
	    
		if (window.XMLHttpRequest) 
		{ 
			 bz_http_request_post = new XMLHttpRequest();
			 if (bz_http_request_post.overrideMimeType) 
			 {
				bz_http_request_post.overrideMimeType('text/html');
			 }
		} else if (window.ActiveXObject) 
		{ 
			  try 
			 {
				bz_http_request_post = new ActiveXObject("Msxml2.XMLHTTP");
			 } catch (e)
			 {
				try 
				{
				   bz_http_request_post = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) 
				{
				
				}
			 }			
		}
        if (!bz_http_request_post) 
	    {
		    alert('Cannot create XMLHTTP instance');
		    return false;
        }			  
	    bz_http_request_post.onreadystatechange = alertContents;
		bz_http_request_post.open('POST', url, true);
		bz_http_request_post.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		bz_http_request_post.setRequestHeader("Content-length", parameters.length);
		bz_http_request_post.setRequestHeader("Connection", "close");
		bz_http_request_post.send(parameters);
	}		
    function alertContents() 
	{
	  if (bz_http_request_post.readyState == 4) 
	  {		
		 if (bz_http_request_post.status == 200) 
		 {	
		    
		 	str=bz_http_request_post.responseText;
			switch (bz_http_request_post_val)
			{				
				default:				    	    
				    document.getElementById('bzAlertContent').innerHTML=str;						    
			}
			         
		 }
	  }
   }
		   
   function bzAjaxSendData(frm,url,val) 
   {
		var poststr="vst="+escape(encodeURI('vcqv'));
		for(i=0;i<frm.elements.length;i++)
			poststr+="&"+frm.elements[i].name+"="+escape(encodeURI(frm.elements[i].value));//su dung urldecode trong php
		bzDoSendAjax(url, poststr,val);
	}
